package ywh.stream
{
	import ywh.event.SyncEvent;
	import ywh.player.AbstractPlayer;
	
	/**
	 * 从流;
	 * @author 杨伟华
	 * @version 1.0
	 *
	 * Created 1/21/2013 4:16 PM
	 */
	public class FollowStream extends MediaStream
	{
		
		public function FollowStream()
		{
			super();
		}
		
		override protected function handlePreSync(e:SyncEvent):void
		{
			super.handlePreSync(e);
			_syncPlayer = shower && shower.preSyncHandle();
		}
		
		override protected function syncList(e:SyncEvent):void
		{
			if (!streamIsActive)
			{
				_syncPlayer = false;
				return;
			}
			super.syncList(e);
		}
		
		override protected function syncPlayer(e:SyncEvent):void
		{
			if (_syncPlayer)
			{
				shower.seekTo(e.time - currentItem.startTime);
			}
		}
	}

}